package org.linlinjava.litemall.wx.util;

import java.util.HashMap;

/**
 * 
* @version:(jdk:java-1.8)
*
* @Description:如需改源码，请规范编写，如：null
*
* @author:  黄嘉猛
*
* @date: 2019年3月2日 上午9:35:25 
*
 */
public class Tips extends HashMap<String,Object>{
	/**成功或者失败**/
	//public boolean isOk=true;
	/**提示码、错误码 一般类名+代码行号**/
	//public String tipscode="tips01";
	/***提示信息**/
	//public String msg="成功";
	
	/**错误字段英文名称**/
	//public String fieldName;
	
	public void setFailureMsg(String msg){
		this.put("isOk", false); 
		this.put("msg", msg);  
	}
	/**
	 * 设置返回客户端的提示信息及错误字段
	 * @param fieldName 错误字段
	 * @param msg 错误提示信息
	 */
	public void setFailureMsg(String fieldName,String msg){ 
		this.put("fieldName", fieldName); 
		this.put("isOk", false); 
		this.put("msg", msg);  
	}
	
	/**
	 * 设置返回客户端的提示信息及错误字段
	 * @param tipscode 提示码、错误码 一般类名+代码行号
	 * @param fieldName 错误字段
	 * @param msg 错误提示信息
	 */
	public void setFailureMsg(String tipscode,String fieldName,String msg){
		this.put("tipscode", tipscode);   
		this.put("fieldName", fieldName); 
		this.put("isOk", false); 
		this.put("msg", msg);   
	}
	
	public void setOkMsg(String msg){
		this.put("isOk", true); 
		this.put("msg", msg);
	}
	

	public Tips() {
		this.put("isOk", true);   
	}
	
	public Tips(String msg) {
		this.put("isOk", true); 
		this.put("msg", msg); 
	}
	
	public Tips(boolean isOk,String msg ) {
		this.put("isOk", isOk);
		this.put("msg", msg);
		
	}
	
	public Tips(boolean isOk,String tipscode,String msg ) {
		this.put("isOk", isOk);
		this.put("msg", msg);
		this.put("tipscode", tipscode);
	}
	public Tips(boolean isOk,String tipscode,String reqFlowNo,String msg ) {
		this.put("isOk", isOk);
		this.put("msg", msg);
		this.put("tipscode", tipscode);
		this.put("reqFlowNo", reqFlowNo);
	}
	 
	 
	public boolean getIsOk() {
		return (boolean) this.get("isOk");
	}
	 
	public String getTipscode() {
		return (String) this.get("tipscode");
	}
	public void setTipscode(String tipscode) {
		this.put("tipscode", tipscode);
	}
	public String getMsg() {
		return (String) this.get("msg");
	}
	public void setMsg(String msg) {
		this.put("msg", msg);
	}
	public String getFieldName() {
		return (String) this.get("fieldName");
	}
	public void setFieldName(String fieldName) {
		this.put("fieldName", fieldName);
	}
	 
	public boolean isOk() {
		// TODO Auto-generated method stub
		return (boolean) this.get("isOk");
	}
}
